<template>
	<view>
		<image @click="getimg" :src="faceshow" mode=""></image>
		<image :src="resultimg" mode=""></image>
	</view>
</template>

<script setup>
	import {ref} from "vue"
	let faceshow=ref("../../../static/my.png")
	let resultimg=ref("")
	
	let getimg=()=>{
		//取相册选择图片或者拍照
		uni.chooseImage({
			sourceType:["album","camera"],
			success:(arg1)=>{
				console.log(arg1.tempFilePaths[0])
				//照片预览
				faceshow.value=arg1.tempFilePaths[0]
				//把图片发送给服务器
				uni.uploadFile({
					formData:{
						x:10,
						x2:33
					}
					url:"http://localhost:7001/aifacegood",
					filePath:arg1.tempFilePaths[0],
					name:"faceimg",
					success: (res) => {
						console.log(res.data)
						resultimg.value=res.data
					}
				})
			}
		})
	}
	
</script>

<style>

</style>
